window.onload = function () {

    //json职位数据
    let jobsjson = {
        'job': '前端开发工程师',
        'money': '12k~18k 13薪',
        'school': '本科',
        'company': '公司',
        'img': 'tat.jpg',
        'local': '苏州 苏州园区 独墅湖'
    }

    //插入头部导航栏组件
    // $.get("header.html", data => $(".headerBox").html(data));
    // $(".footBox").load("foot.html")


    //头部轮播图
    let imgarr = ["http://rr2xgprkx.hn-bkt.clouddn.com/2023/03/20/3.png",
        "http://rr2xgprkx.hn-bkt.clouddn.com/2023/03/20/2.png",
        "http://rr2xgprkx.hn-bkt.clouddn.com/2023/03/20/4.png"];
    let imgs = document.querySelector(".box_right img")
    let index = 0;
    setInterval(function () {
        if (index != 3) {
            imgs.src = imgarr[index];
            index++
        } else {
            index = 0;
            imgs.src = imgarr[index];
        }
    }, 2000)


    //jobs动态渲染事件
    let jobs = document.querySelectorAll('.jobs_onediv');
    let strjobs = "";
    for (var i = 0; i < 3; i++) {
        strjobs += '<ul>';
        for (var j = 0; j < 3; j++) {
            strjobs += `<li>
            <a href="#">
            <div class="jobmsgs">
                
                <div>
                    <p>${jobsjson.job}</p>
                    <p>${jobsjson.money}</p>
                </div>
                
                <div>
                    <span>${jobsjson.school}</span>
                </div>
                <div>
                    <p><img src="img/${jobsjson.img}" width="25px" height="25px">&nbsp;${jobsjson.company}</p>
                    <p>${jobsjson.local}</p>
                </div>
            </div>
            </a>
        </li>`
        }
        strjobs += '</ul>';
    }
    // jobs[0].innerHTML = strjobs;
    // jobs[1].innerHTML = strjobs;


    //渲染公司职位信息
    let comJobs = "";
    for (var i = 0; i < 3; i++) {
        comJobs += `<ul>`
        for (var j = 0; j < 3; j++) {
            comJobs += `<li>
            <div class="companys">
                <div class="oneC_div">
                    <div>
                        <img src="img/tat.jpg" width="30px" height="30px">
                    </div>
                    <div>
                        <p>万科物业</p>
                        <p>已上市 | 10000人以上 | 物业服务</p>
                    </div>
                </div>
                <div class="job_item">
                    <a href="#">
                        <div>
                            <p>${jobsjson.job}</p>
                            <p>${jobsjson.money}</p>
                        </div>
                        <div>
                            <span>${jobsjson.school}</span>
                        </div>
                    </a>
                </div>
                <div class="job_item">
                    <a href="#">
                        <div>
                            <p>${jobsjson.job}</p>
                            <p>${jobsjson.money}</p>
                        </div>
                        <div>
                            <span>${jobsjson.school}</span>
                        </div>
                    </a>
                </div>
                <div class="job_item">
                    <a href="#">
                        <div>
                            <p>${jobsjson.job}</p>
                            <p>${jobsjson.money}</p>
                        </div>
                        <div>
                            <span>${jobsjson.school}</span>
                        </div>
                    </a>
                </div>
                <div class="jon_item_last">
                <a href="#"> <div>
                查看更多
            </div></a>
                   
                </div>
            </div>
        </li>`;
        }
        comJobs += '</ul>';
    }
    jobs[2].innerHTML = comJobs;

    if($(".loginA").text()!="请登录")
    {
        console.log("kkkkkkk")
        let nav_right_event = document.querySelector(".nav_right li:nth-child(3)");
        let nav_right_div = document.querySelector(".nav_right_msg");

        nav_right_event.onmouseover = function () {
            nav_right_div.setAttribute('style', "display:block");
        }
        nav_right_event.onmouseout = function () {
            nav_right_div.setAttribute('style', "display:none");
        }

        nav_right_div.onmouseover = function () {
            nav_right_div.setAttribute('style', "display:block");
        }
        nav_right_div.onmouseout = function () {
            nav_right_div.setAttribute('style', "display:none");
        }
    }

}

function signOut() {
    localStorage.clear();
    window.location.replace("/dev/login/signout");
}

function login() {
    window.location.replace("/dev/login");
}

